# Maintainer: Luca Weiss <luca@z3ntu.xyz>
# Contributor: Brandon Boese <brandonboese@protonmail.com>
pkgname=lomiri-telephony-service
pkgver=0.5.3
pkgrel=0
pkgdesc="Backend dispatcher service for various mobile phone related operations"
url="https://gitlab.com/ubports/development/core/telephony-service"
# armhf: blocked by lomiri-libusermetrics
# s390x/riscv64: blocked by ayatana-indicator-messages
arch="all !armhf !s390x !riscv64"
license="GPL-3.0-only"
depends="
	dconf
	telepathy-mission-control
	"
makedepends="
	ayatana-indicator-messages-dev
	cmake
	libnotify-dev
	libphonenumber-dev
	libqtdbustest
	lomiri-api-dev
	lomiri-history-service-dev
	lomiri-libusermetrics-dev
	lomiri-url-dispatcher-dev
	pulseaudio-dev
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	qt5-qtfeedback-dev
	qt5-qtmultimedia-dev
	qt5-qtpim-dev
	telepathy-qt-dev
	samurai
	"
checkdepends="dbus-test-runner xvfb-run"
source="https://gitlab.com/ubports/development/core/telephony-service/-/archive/$pkgver/telephony-service-$pkgver.tar.gz"
subpackages="$pkgname-lang"
builddir="$srcdir/telephony-service-$pkgver"
options="!check" # Various tests hang

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DCMAKE_INSTALL_SYSCONFDIR=/etc \
		-DCMAKE_INSTALL_LOCALSTATEDIR=/var \
		-DSKIP_QML_TESTS=ON
	cmake --build build
}

check() {
	xvfb-run ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
f0632c9008378568c3b4fa8b93216afc9e004d9313865487c1c06866c9bfddb4e96071411721c2785960a33631dd3ade7b2491333ad2c17c8e40626e1e5c5b2a  telephony-service-0.5.3.tar.gz
"
